Page({
  data: {
    h5Url: '',
    status: '',
    order_no: '',
  },
  onLoad(options) {
    this.setData({
      status: options.status,
      order_no: options.status,
    });
    let that = this;
    my.request({
      url: 'https://openpay.duolaibei.com/api/getUrl',
      headers: {
        'Content-type': 'application/json'
      },
      method: 'post',
      data: {
        order_no: options.order_no
      },
      success: (result) => {
        //status   1 成功  2支付取消  3失败  4 下单失败
        if (result.data.code == 200) {
          let url = result.data.content;
          let webUrl = url + '&status=' + options.status + '&order_no=' + options.order_no;
          that.setData({
            h5Url: webUrl
          });
        } else {
          my.confirm({
            content: '您没有设置跳转地址，现将跳转到首页',
            confirmButtonText: '确认',
            success: (result) => {
              my.navigateTo({
                url: '/pages/index/index'
              });
            }
          });
        }
      },
      fail: () => {

      }
    });

  },
});
